﻿namespace homework1
{

    class Test
    {
        static void Main(string []args)
        {
            List<int> list = new List<int>();
            Random random = new Random();
            for (int i = 0; i < 100; i++)
            {
                int num=random.Next(1000);
                list.Add(num);
            }
            var query = from num in list orderby num select num;
            int sum = query.Sum();
            double average = query.Average();
            Console.WriteLine("排序后的数为：");
            foreach (var num in query)
            {
                Console.Write(num+" ");
            }
            Console.WriteLine();
            Console.WriteLine("这些数的和为："+sum);
            Console.WriteLine("这些数的平均数为："+average);
        }
    }
}